<?php

namespace JSSDK\Model;


/**
 * YFUserInfo 信息，user_info 接口返回数据
 *
 * Class YFUserInfo
 * @package JSSDK\Model
 */
class YFUserInfo
{
    /**
     * YFUserInfo constructor.
     *
     * @param string $location
     * @param string $name
     * @param string $createDate
     */
    public function __construct($code, $message, $user)
    {
        self::$code = $code;
        self::$message = $message;
        $_SESSION['JSSDK_YF_USERINFO'] = $user;
        self::$user = $user;
    }

    /**
     *得到code的值
     *
     * @return string
     */
    public static function getCode()
    {
        return self::$code;
    }

    /**
     * 得到message的名称
     *
     * @return string
     */
    public static function getMessage()
    {
        return self::$message;
    }

    /**
     * 得到bucket的创建时间
     *
     * @return string
     */
    public static function getUser()
    {
        if(isset($_SESSION['JSSDK_YF_USERINFO'])){
            self::$user = $_SESSION['JSSDK_YF_USERINFO'];
        }
        return self::$user;
    }

    /**
     * 得到bucket的创建时间
     *
     * @return string
     */
    public static function setUser($user)
    {
        $_SESSION['JSSDK_YF_USERINFO'] = $user;
        self::$user = $_SESSION['JSSDK_YF_USERINFO'];
    }

    /**
     * code 返回值
     *
     * @var string
     */
    private static $code;
    /**
     * message的名称
     *
     * @var string
     */
    private static $message;

    /**
     * user的创建事件
     *
     * @var string
     */
    private static $user;

}